<?php

namespace Admin\Controller;

class MyMemberAddrController extends AdminController 
{

	/**
	 * 会员收货地址列表
	 * @return [type] [description]
	 * @author Weiliqiang <[<email address>]>
	 */
	public function addrlist()
	{
    
		// 获取排序条件
    $content = null != (string)(I('request.sort')) ? (string)(I('request.sort')) : 'desc';
    $order['addr_id'] = $content;

		// 获取搜索的条件
		$receiver       =   I('receiver');
    $map['status']  =   array('egt',0);
    if(is_numeric($receiver)){
        $map['user_id|receiver']=   array(intval($receiver),array('like','%'.$receiver.'%'),'_multi'=>true);
    }else{
        $map['receiver']    =   array('like', '%'.(string)$receiver.'%');
    }

		$list = $this->lists('user_addr',$map,$order);

		$this->assign('list',$list);
		$this->display();
	}

	public function sort()
	{

			$user_addr= new \Admin\Model\MyMemberAddrModel('user_addr');
			
			$list=$user_addr->mysort();
			//  // 变量赋值
			$this->assign('list',$list);
			// 模板展示
			$this->display('addrlist');
	}
	 
}
